//
//  PaperCardCell.m
//  DoingPaper
//
//  Created by zhuxuhong on 16/8/2.
//  Copyright © 2016年 zhuxuhong. All rights reserved.
//

#import "PaperCardCell.h"


@implementation PaperCardCell

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = [UIColor greenColor];
        UIButton *btn = [UIButton buttonWithType: UIButtonTypeSystem];
        btn.frame = self.contentView.bounds;
        [btn setTintColor: [UIColor whiteColor]];
        btn.titleLabel.font = [UIFont systemFontOfSize:16];
        _button = btn;
        
        [self.contentView addSubview:_button];
    }
    return self;
}

-(void)setQuestionNum:(NSInteger)questionNum{
    [_button setTitle:[NSString stringWithFormat:@"%ld",questionNum] forState:UIControlStateNormal];
    _questionNum = questionNum;
}

-(void)setFinished: (BOOL)finished{
    _button.backgroundColor = finished ? [UIColor colorWithRed:36/255.0 green:154/255.0 blue:131/255.0 alpha:1] : [UIColor lightGrayColor];
    _finished = finished;
}

@end


/**
 *  PaperCardHeaderView
 */

@implementation PaperCardHeaderView

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = [UIColor colorWithRed:36/255.0 green:154/255.0 blue:131/255.0 alpha:1];
        
        UILabel *lb = [[UILabel alloc]initWithFrame:self.bounds];
        lb.textAlignment = NSTextAlignmentCenter;
        lb.textColor = [UIColor whiteColor];
        lb.font = [UIFont systemFontOfSize:14];
        _label = lb;
        
        [self addSubview: _label];
    }
    return self;
}

@end

